<?php
class omeauto_condition_ordermark extends omeauto_auto{
    public $name = '附加信息';
    
    /*
     * 
     * 设置获取主html时的一些自定义smarty变量
     */
    function pagedata($data){
        $pagedata = array();
        
        if($data){
            $pagedata['custom_mark'] = $data['custom_mark'];
		    $pagedata['mark'] = $data['mark'];
        }else{
            $pagedata['custom_mark'] = "true";
			$pagedata['mark'] = "true";
        }
        
        return $pagedata;
    }
    
    /*
     * 获取条件的详情
     */
    function condition_detail($data){
        
        return parent::condition_detail($data);
    }
    
    /*
     * 下拉详情
     */
    function detail_basic($data){
        $render = $this->get_render();
        
        $render->pagedata['custom_mark'] = $data['custom_mark'];
		$render->pagedata['mark'] = $data['mark'];
     
        return $render->fetch("condition/ordermark/detail_basic.html");
    }
    
    /*
     * 验证发货单的sdf数据条件是否通过
     * 
     */
    function validate($order_sdf,$condition_data){
        $vail_custom_mark = $condition_data['custom_mark']  ? $condition_data['custom_mark']  : 'false';
		$vail_mark = $condition_data['mark']  ? $condition_data['mark']  : 'false';
		
		if($vail_mark == 'false' && $vail_custom_mark == 'false'){
			return true;
		}elseif( $vail_mark == 'true' && $vail_custom_mark == 'true' ){
			if(!$order_sdf['mark_text'] && !$order_sdf['custom_mark'] ){
				return true;
			}else{
				return false;
			}
		}elseif( ($vail_mark == 'true' && !$order_sdf['mark_text']) ||  ($vail_custom_mark == 'true' && !$order_sdf['custom_mark'])){
			return true;
		}else{
		 	return false;	
		}
    }
    
    
    /*********************************************以下是非必须函数，多为过程函数*******************************************************/

}